from django.db import models

# Create your models here.

class Student(models.Model): # 定义学生表模型类
    class Meta:
        db_table= "student"  #定义模型类对应的表名称

    stu_no = models.IntegerField(primary_key=True,verbose_name='学号') # 定义stu_no 为主键，默认不为空
    age = models.SmallIntegerField(verbose_name='年龄')
    name = models.CharField(max_length=30,verbose_name='姓名')
#   score = models.ForeignKey('Score',on_delete=models.CASCADE)

    def __repr__(self):
        return self.name

    def __str__(self):
        return self.name

class Score(models.Model):
    class Meta:
        db_table = "score"

    stu_no = models.IntegerField(primary_key=True,verbose_name='学号')
    chinese = models.FloatField(verbose_name='语文')
    math = models.FloatField(verbose_name='数学')
    english = models.FloatField(verbose_name='英语')

